<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

Route::get('/', function () {
    return view('welcome'); //路由视图
})->name('index');

Auth::routes();


//中间件 需要登录
Route::middleware('auth')->group(function () {

    Route::get('/home', 'HomeController@chatList')->name('chatList');

    //聊天室
    Route::get('/chatList', 'HomeController@chatList')->name('chatList');
    Route::get('/chatRoom/{id}', 'HomeController@chatRoom')->where('id', '[0-9]+');  //路由参数 命名路由

    //直播间
    Route::get('/liveList', 'HomeController@liveList')->name('liveList');
    Route::get('/liveRoom/{id}', 'HomeController@liveRoom')->where('id', '[0-9]+');  //路由参数 命名路由
});

//关于我们
Route::get('/about', 'HomeController@about')->name('about');
Route::get('/help', 'HomeController@help')->name('help');


//会员中心
Route::prefix('user')->middleware(['auth'])->group(function () {
    Route::get('user_info', 'UserController@user_info')->name('user_info');
    Route::get('exit_password', 'UserController@exit_password')->name('exit_password');    //修改密码
    Route::get('live', 'UserController@live')->name('live');
    Route::post('createLive', 'UserController@createLive')->where('user_id', '[0-9]+');   //开通直播间
    Route::post('updateLive', 'UserController@updateLive')->where('user_id', '[0-9]+');   //修改直播间
});


//命名空间
Route::namespace('Admin')->group(function () {
    // Controllers Within The "App\Http\Controllers\Admin" Namespace
});


